import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import Components from 'unplugin-vue-components/vite'//这里
import AutoImport from 'unplugin-auto-import/vite'//这里
import path from 'path'


import {
  ElementPlusResolver
} from 'unplugin-vue-components/resolvers'//这里

import { VantResolver } from 'unplugin-vue-components/resolvers';
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'


// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(),
    createSvgIconsPlugin({
       // 图标文件夹为src/assets/icons
       iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')],
       // 指定symbolId格式
       symbolId: 'icon-[dir]-[name]',
    }),
    AutoImport({//这里
      resolvers: [ElementPlusResolver()],
    }),
    Components({//这里
      resolvers: [ElementPlusResolver(),VantResolver()],
      directoryAsNamespace: true,
    }),vueJsx()],
    define: {
      'process.env': {}
    },  
    resolve: {
      // 配置路径别名
      alias: {
        '@': path.resolve(__dirname, './src'),
      },
      extensions: ['.vue', '.ts', '.tsx', '.js', '.jsx']
    },
  server: {
      host: '0.0.0.0',
      port: '1024',
      open: true,
    },
})

